package wrapper;

/**
 * 
 * @author mariusz marek mesjasz
 *
 */
public class SunSpotWrapper {
	
	public static final String default_serial_port = "dummyport";
	
	public static final String default_spot_basestation_sharing = "true";
	
	public static final String default_remote_channel = "26";
	
	public static final String default_remote_pan_id = "3";
	
	public static final String default_remote_transmit_power = "0";
	
	public static final String default_spot_mesh_route_logging = "false";
	
	public static final String default_spot_mesh_routing_enable = "false";
	
	public static final String default_spot_log_connections = "true";
	
	public static final String default_spotclient_verbose = "false";
	
	public static final String default_error_log = "";
	
	public static void initSunSpot() {
		SunSpotWrapper.initSunSpot(null, null, null, null, null, null, null, null, null, null);
	}
	
	public static void initSunSpot(String serial_port, String spot_basestation_sharing, String remote_channel,
			String remote_pan_id, String remote_transmit_power, String spot_mesh_route_logging,
			String spot_mesh_routing_enable, String spot_log_connections, String spotclient_verbose,
			String error_log) {
		
		System.setProperty(
				"squawk.startup.agruments",
				"-Xboot:268763136 -Xmxnvm:0 -isolateinit:com.sun.spot.peripheral.Spot -dma: 1024");
		if(serial_port == null)
			System.setProperty("SERIAL_PORT", SunSpotWrapper.default_serial_port);
		else
			System.setProperty("SERIAL_PORT", serial_port);
		if(spot_basestation_sharing == null)
			System.setProperty("spot.basestation.sharing", SunSpotWrapper.default_spot_basestation_sharing);
		else
			System.setProperty("spot.basestation.sharing", spot_basestation_sharing);
		if(remote_channel == null)
			System.setProperty("remote.channel", SunSpotWrapper.default_remote_channel);
		else
			System.setProperty("remote.channel", remote_channel);
		if(remote_pan_id == null)
			System.setProperty("remote.pan.id", SunSpotWrapper.default_remote_pan_id);
		else
			System.setProperty("remote.pan.id", remote_pan_id);
		if(remote_transmit_power == null)
			System.setProperty("remote.transmit.power", SunSpotWrapper.default_remote_transmit_power);
		else
			System.setProperty("remote.transmit.power", remote_transmit_power);
		if(spot_mesh_route_logging == null)
			System.setProperty("spot.mesh.route.logging", SunSpotWrapper.default_spot_mesh_route_logging);
		else
			System.setProperty("spot.mesh.route.logging", spot_mesh_route_logging);
		if(spot_mesh_routing_enable == null)
			System.setProperty("spot.mesh.routing.enable", SunSpotWrapper.default_spot_mesh_routing_enable);
		else
			System.setProperty("spot.mesh.routing.enable", spot_mesh_routing_enable);
		if(spot_log_connections == null)
			System.setProperty("spot.log.connections", SunSpotWrapper.default_spot_log_connections);
		else
			System.setProperty("spot.log.connections", spot_log_connections);
		if(spotclient_verbose == null)
			System.setProperty("spotclient.verbose", SunSpotWrapper.default_spotclient_verbose);
		else
			System.setProperty("spotclient.verbose", spotclient_verbose);
		if(error_log == null)
			System.setProperty("error.log", SunSpotWrapper.default_error_log);
		else
			System.setProperty("error.log", error_log);
	}
}
